home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / rpm / rpmspec.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-22  |  6.0 KB  |  295 lines

  1. #ifndef _H_SPEC_
  2. #define _H_SPEC_
  3.  
  4. /** \ingroup rpmbuild
  5.  * \file build/rpmspec.h
  6.  *  The Spec and Package data structures used during build.
  7.  */
  8.  
  9. /** \ingroup rpmbuild
  10.  */
  11. typedef struct Package_s * Package;
  12.  
  13. /** \ingroup rpmbuild
  14.  */
  15. struct TriggerFileEntry {
  16.     int index;
  17. /*@only@*/ char * fileName;
  18. /*@only@*/ char * script;
  19. /*@only@*/ char * prog;
  20. /*@owned@*/ struct TriggerFileEntry * next;
  21. };
  22.  
  23. #define RPMBUILD_ISSOURCE    (1 << 0)
  24. #define RPMBUILD_ISPATCH    (1 << 1)
  25. #define RPMBUILD_ISICON        (1 << 2)
  26. #define RPMBUILD_ISNO        (1 << 3)
  27.  
  28. #define RPMBUILD_DEFAULT_LANG "C"
  29.  
  30. /** \ingroup rpmbuild
  31.  */
  32. struct Source {
  33. /*@owned@*/ char * fullSource;
  34. /*@dependent@*/ char * source;     /* Pointer into fullSource */
  35.     int flags;
  36.     int num;
  37. /*@owned@*/ struct Source * next;
  38. };
  39.  
  40. /** \ingroup rpmbuild
  41.  */
  42. /*@-typeuse@*/
  43. typedef struct ReadLevelEntry {
  44.     int reading;
  45. /*@dependent@*/
  46.     struct ReadLevelEntry * next;
  47. } RLE_t;
  48. /*@=typeuse@*/
  49.  
  50. /** \ingroup rpmbuild
  51.  */
  52. typedef struct OpenFileInfo {
  53. /*@only@*/ const char * fileName;
  54.     FD_t fd;
  55.     int lineNum;
  56.     char readBuf[BUFSIZ];
  57. /*@dependent@*/
  58.     char * readPtr;
  59. /*@owned@*/
  60.     struct OpenFileInfo * next;
  61. } OFI_t;
  62.  
  63. /** \ingroup rpmbuild
  64.  */
  65. typedef struct spectag_s {
  66.     int t_tag;
  67.     int t_startx;
  68.     int t_nlines;
  69. /*@only@*/ const char * t_lang;
  70. /*@only@*/ const char * t_msgid;
  71. } * spectag;
  72.  
  73. /** \ingroup rpmbuild
  74.  */
  75. typedef struct spectags_s {
  76. /*@owned@*/ spectag st_t;
  77.     int st_nalloc;
  78.     int st_ntags;
  79. } * spectags;
  80.  
  81. /** \ingroup rpmbuild
  82.  */
  83. typedef struct speclines_s {
  84. /*@only@*/ char **sl_lines;
  85.     int sl_nalloc;
  86.     int sl_nlines;
  87. } * speclines;
  88.  
  89. /** \ingroup rpmbuild
  90.  * The structure used to store values parsed from a spec file.
  91.  */
  92. struct Spec_s {
  93. /*@only@*/
  94.     const char * specFile;    /*!< Name of the spec file. */
  95. /*@only@*/
  96.     const char * buildRootURL;
  97. /*@only@*/
  98.     const char * buildSubdir;
  99. /*@only@*/
  100.     const char * rootURL;
  101.  
  102. /*@owned@*/ /*@null@*/
  103.     speclines sl;
  104. /*@owned@*/ /*@null@*/
  105.     spectags st;
  106.  
  107. /*@owned@*/
  108.     struct OpenFileInfo * fileStack;
  109.     char lbuf[10*BUFSIZ];
  110. /*@dependent@*/
  111.     char *lbufPtr;
  112.     char nextpeekc;
  113. /*@dependent@*/
  114.     char * nextline;
  115. /*@dependent@*/
  116.     char * line;
  117.     int lineNum;
  118.  
  119. /*@owned@*/
  120.     struct ReadLevelEntry * readStack;
  121.  
  122. /*@refcounted@*/
  123.     Header buildRestrictions;
  124. /*@owned@*/ /*@null@*/
  125.     Spec * BASpecs;
  126. /*@only@*/ /*@null@*/
  127.     const char ** BANames;
  128.     int BACount;
  129.     int recursing;        /*!< parse is recursive? */
  130.  
  131.     int force;
  132.     int anyarch;
  133.  
  134.     int gotBuildRootURL;
  135.  
  136. /*@null@*/
  137.     char * passPhrase;
  138.     int timeCheck;
  139. /*@null@*/
  140.     const char * cookie;
  141.  
  142. /*@owned@*/
  143.     struct Source * sources;
  144.     int numSources;
  145.     int noSource;
  146.  
  147. /*@only@*/
  148.     const char * sourceRpmName;
  149. /*@only@*/
  150.     unsigned char * sourcePkgId;
  151. /*@refcounted@*/
  152.     Header sourceHeader;
  153. /*@refcounted@*/
  154.     rpmfi sourceCpioList;
  155.  
  156. /*@dependent@*/ /*@null@*/
  157.     MacroContext macros;
  158.  
  159. /*@only@*/
  160.     StringBuf prep;        /*!< %prep scriptlet. */
  161. /*@only@*/
  162.     StringBuf build;        /*!< %build scriptlet. */
  163. /*@only@*/
  164.     StringBuf install;        /*!< %install scriptlet. */
  165. /*@only@*/
  166.     StringBuf check;        /*!< %check scriptlet. */
  167. /*@only@*/
  168.     StringBuf clean;        /*!< %clean scriptlet. */
  169.  
  170. /*@owned@*/
  171.     Package packages;        /*!< Package list. */
  172. };
  173.  
  174. /** \ingroup rpmbuild
  175.  * The structure used to store values for a package.
  176.  */
  177. struct Package_s {
  178. /*@refcounted@*/
  179.     Header header;
  180. /*@refcounted@*/
  181.     rpmds ds;            /*!< Requires: N = EVR */
  182. /*@refcounted@*/
  183.     rpmfi cpioList;
  184.  
  185. /*@owned@*/
  186.     struct Source * icon;
  187.  
  188.     int autoReq;
  189.     int autoProv;
  190.  
  191. /*@only@*/
  192.     const char * preInFile;    /*!< %pre scriptlet. */
  193. /*@only@*/
  194.     const char * postInFile;    /*!< %post scriptlet. */
  195. /*@only@*/
  196.     const char * preUnFile;    /*!< %preun scriptlet. */
  197. /*@only@*/
  198.     const char * postUnFile;    /*!< %postun scriptlet. */
  199. /*@only@*/
  200.     const char * preTransFile;    /*!< %pretrans scriptlet. */
  201. /*@only@*/
  202.     const char * postTransFile;    /*!< %posttrans scriptlet. */
  203. /*@only@*/
  204.     const char * verifyFile;    /*!< %verifyscript scriptlet. */
  205.  
  206. /*@only@*/
  207.     StringBuf specialDoc;
  208.  
  209. /*@only@*/
  210.     struct TriggerFileEntry * triggerFiles;
  211.  
  212. /*@only@*/
  213.     const char * fileFile;
  214. /*@only@*/
  215.     StringBuf fileList;        /* If NULL, package will not be written */
  216.  
  217. /*@dependent@*/
  218.     Package next;
  219. };
  220.  
  221. #ifdef __cplusplus
  222. extern "C" {
  223. #endif
  224.  
  225. /** \ingroup rpmbuild
  226.  * Create and initialize Spec structure.
  227.  * @return spec        spec file control structure
  228.  */
  229. /*@only@*/ Spec newSpec(void)
  230.     /*@globals rpmGlobalMacroContext @*/
  231.     /*@modifies rpmGlobalMacroContext @*/;
  232.  
  233. /** \ingroup rpmbuild
  234.  * Destroy Spec structure.
  235.  * @param spec        spec file control structure
  236.  * @return        NULL always
  237.  */
  238. /*@null@*/ Spec freeSpec(/*@only@*/ /*@null@*/ Spec spec)
  239.     /*@globals fileSystem, internalState @*/
  240.     /*@modifies spec, fileSystem, internalState @*/;
  241.  
  242. /** \ingroup rpmbuild
  243.  * Function to query spec file(s).
  244.  * @param ts        transaction set
  245.  * @param qva        parsed query/verify options
  246.  * @param arg        query argument
  247.  * @return        0 on success, else no. of failures
  248.  */
  249. int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)
  250.     /*@globals rpmGlobalMacroContext, h_errno,
  251.         fileSystem, internalState @*/
  252.     /*@modifies ts, qva, rpmGlobalMacroContext,
  253.         fileSystem, internalState @*/;
  254.  
  255. /** \ingroup rpmbuild
  256.  */
  257. struct OpenFileInfo * newOpenFileInfo(void)
  258.     /*@*/;
  259.  
  260. /** \ingroup rpmbuild
  261.  * @param spec        spec file control structure
  262.  * @param h
  263.  * @param tag
  264.  * @param lang
  265.  */
  266. spectag stashSt(Spec spec, Header h, int tag, const char * lang)
  267.     /*@modifies spec->st @*/;
  268.  
  269. /** \ingroup rpmbuild
  270.  * @param spec        spec file control structure
  271.  * @param pkg        package control
  272.  * @param field
  273.  * @param tag
  274.  */
  275. int addSource(Spec spec, Package pkg, const char * field, int tag)
  276.     /*@globals rpmGlobalMacroContext, h_errno @*/
  277.     /*@modifies spec->sources, spec->numSources,
  278.         spec->st, spec->macros,
  279.         pkg->icon,
  280.         rpmGlobalMacroContext @*/;
  281.  
  282. /** \ingroup rpmbuild
  283.  * @param spec        spec file control structure
  284.  * @param field
  285.  * @param tag
  286.  */
  287. int parseNoSource(Spec spec, const char * field, int tag)
  288.     /*@modifies nothing @*/;
  289.  
  290. #ifdef __cplusplus
  291. }
  292. #endif
  293.  
  294. #endif /* _H_SPEC_ */
  295.